/**
 * Copyright 2013 ABSir's Studio
 * 
 * All right reserved
 *
 * Create on 2013-6-18 下午1:47:59
 */
package com.absir.bean.core;

import com.absir.bean.basis.BeanFactory;
import com.absir.bean.basis.BeanScope;

/**
 * @author absir
 * 
 */
public class BeanFactoryUtils {

	/**
	 * @return
	 */
	public static BeanFactory getBeanFactory() {
		return getBeanFactoryImpl();
	}

	/**
	 * @return
	 */
	private static BeanFactoryImpl getBeanFactoryImpl() {
		return BeanFactoryImpl.getInstance();
	}

	/**
	 * @param beanObject
	 */
	public static void processBeanObjec(Object beanObject) {
		processBeanObjec(BeanScope.PROTOTYPE, beanObject);
	}

	/**
	 * @param beanScope
	 * @param beanObject
	 */
	public static void processBeanObjec(BeanScope beanScope, Object beanObject) {
		getBeanFactoryImpl().processBeanObject(beanScope, beanObject);
	}

	/**
	 * @param androidBean
	 */
	public static void onCreate(Object androidBean) {
		getBeanFactoryImpl().registerStackBeanObject(androidBean);
		processBeanObjec(androidBean);
	}

	/**
	 * @param androidBean
	 */
	public static void onDestroy(Object androidBean) {
		getBeanFactoryImpl().unRegisterStackBeanObject(androidBean);
	}
}
